benchmark: measure Lightpanda startup until CDP is ready - #32
Open
krichprollsch wants to merge 1 commit into
Open
benchmark: measure Lightpanda startup until CDP is ready#32krichprollsch wants to merge 1 commit into
krichprollsch wants to merge 1 commit into
Conversation
startLightpanda() now polls puppeteer.connect() until it succeeds (10s deadline, fails fast if the process exits early) and returns the connected Browser, so the measured startup time is comparable to puppeteer.launch() for Chrome — "time until usable" instead of "time until spawn() returned". The previous fixed 1500ms sleep both inflated the number and made it independent of actual startup cost. Teardown waits for the process exit event instead of sleeping 500ms. Bump ITERATIONS to 100 and switch TEST_URL to example.org.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Here is an update of the Lightpanda benchmark introduced by #28
Problem
startLightpanda()inbenchmarks/compare.tsresolved after a hardcodedsetTimeout(..., 1500). That meant the reported "startup" figure for Lightpandawas really just the sleep constant — it did not measure anything about the
browser, and it was not comparable to the Chrome number, which comes from
puppeteer.launch()(i.e. time until the browser is actually usable).Teardown had the same problem in reverse:
proc.kill()followed by a blind500 ms sleep to "let the port be released".
Change
startLightpanda()now pollspuppeteer.connect()until it succeeds andreturns the connected
Browseralongside the process. The measured durationis now "time until the browser accepts a CDP connection", which is the same
thing
puppeteer.launch()measures for Chrome.(the common cause being port 9222 already in use).
stopLightpanda(), which waits on the processexitevent instead ofsleeping a fixed 500 ms.
benchmarkLightpanda()reuses theBrowserreturned bystartLightpanda()rather than opening a second connection outside the measured region — the
previous code paid the connect cost twice and excluded it from the timing.
ITERATIONS5 → 100,TEST_URLexample.com→example.org.Results
Run on this branch, 100 iterations per browser, Chrome
/usr/bin/google-chrome, Lightpanda1.0.0-nightly.8285+de85a51d:Startup speedup: 6.4x